Import
Usage
Examples
- Basic Usage
 - Multiple Assets
 - Custom Fallback
 
Basic example of using the Media component to display an image:
Parameters
The component accepts the following props:| Parameter | Type | Description | 
|---|---|---|
name | string | Optional name for the collectible, used as alt text for images | 
assets | (string | undefined)[] | Array of asset URLs to try loading. The component will attempt to load each asset in order until one succeeds | 
assetSrcPrefixUrl | string | Optional URL prefix to prepend to asset URLs | 
className | string | Optional CSS class name for the component container | 
containerClassName | string | Optional CSS class name for the outer container | 
mediaClassname | string | Optional CSS class name for the media element itself | 
isLoading | boolean | Optional flag to show loading state | 
fallbackContent | React.ReactNode | Optional custom content to display when no assets can be loaded | 
shouldListenForLoad | boolean | Optional flag to enable/disable load event listeners (defaults to true) | 
Supported Media Types
The Media component automatically detects and handles different types of content:- Images: Renders standard image files (PNG, JPG, GIF, etc.)
 - Videos: Supports video files with autoplay, loop, and controls
 - 3D Models: Renders 3D models using ModelViewer component
 - HTML: Displays HTML content in a sandboxed iframe
 
Features
Automatic Content Type Detection
The component automatically detects the content type of the asset and renders the appropriate element:Fallback Chain
If an asset fails to load, the component will:- Try the next asset in the assets array
 - If all assets fail, display the custom fallback content
 - If no fallback content is provided, show the default chess tile pattern
 
Loading States
The component includes built-in loading states:Notes
TheMedia component is designed to handle various types of collectible assets with built-in:
- Automatic content type detection
 - Fallback handling
 - Loading states
 - Safari compatibility adjustments
 
- Videos autoplay by default
 - Videos are muted by default for autoplay compatibility